#include <bits/stdc++.h>
using namespace std;
const int MAX_N = 1000000;
template <typename T>
void printV(const std::vector<T>& v, const char* const separator = " ") {
  if (!v.empty()) {
    std::copy(v.begin(), --v.end(),
              std::ostream_iterator<T>(std::cout, separator));
    std::cout << v.back() << "\n";
  }
}
int64_t gcd(int64_t a, int64_t b) { return b != 0 ? gcd(b, a % b) : a; }
int64_t lcm(int64_t a, int64_t b) { return a / gcd(a, b) * b; }
int Max(int a, int b, int c) {
  int temp = max(a, b);
  return max(temp, c);
}
int Min(int a, int b, int c) {
  int temp = min(a, b);
  return min(temp, c);
}
bool integer(double num) { return floor(num) == num; }
int64_t fact(int num) {
  if (num == 0)
    return 1;
  else
    return num * fact(num - 1);
}
void y() {
  cout << "Yes"
       << "\n";
  exit(0);
}
void n() {
  cout << "No"
       << "\n";
  exit(0);
}
void Y() {
  cout << "YES"
       << "\n";
  exit(0);
}
void N() {
  cout << "NO"
       << "\n";
  exit(0);
}
int64_t yakusu(int n) {
  int cnt = 0;
  for (int i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      cnt++;
      if (i * i != n) cnt++;
    }
  }
  return cnt;
}
int cnt = 0;
bool is_prime[50000 + 1];
vector<int> P;
void Eratosthenes(const int N) {
  for (int i = 0; i <= N; i++) {
    is_prime[i] = true;
  }
  for (int i = 2; i <= N; i++) {
    if (is_prime[i]) {
      for (int j = 2 * i; j <= N; j += i) {
        is_prime[j] = false;
      }
      P.emplace_back(i);
    }
  }
}
bool compare_by_b(pair<int, int> a, pair<int, int> b) {
  if (a.second != b.second) {
    return a.second < b.second;
  } else {
    return a.first < b.first;
  }
}
vector<int64_t> divisor(int64_t n) {
  vector<int64_t> ret;
  for (int64_t i = 1; i * i <= n; i++) {
    if (n % i == 0) {
      ret.push_back(i);
      if (i * i != n) ret.push_back(n / i);
    }
  }
  sort(begin(ret), end(ret));
  return (ret);
}
void euclid(int64_t N, int64_t a, int64_t b) {
  for (int64_t d = a + b; d <= N; d += b) {
    euclid(N, b, d);
  }
}
long long modinv(long long a, long long m) {
  long long b = m, u = 1, v = 0;
  while (b) {
    long long t = a / b;
    a -= t * b;
    swap(a, b);
    u -= t * v;
    swap(u, v);
  }
  u %= m;
  if (u < 0) u += m;
  return u;
}
int64_t nnn(int64_t n) {
  int64_t a = 1;
  for (int64_t l = 1; l <= n; ++l) {
    a = a * l % 1000000007;
  }
  if (n < 2)
    return 1;
  else
    return a;
}
int64_t modPow(int64_t a, int64_t x, int64_t p) {
  int64_t res = 1;
  while (x > 0) {
    if (x % 2 != 0) {
      res = (res * a) % p;
    }
    a = (a * a) % p;
    x /= 2;
  }
  return res;
}
int64_t modInverse(int64_t a, int64_t p) { return modPow(a, p - 2, p); }
int64_t modBinomial(int64_t n, int64_t k, int64_t p) {
  int64_t numerator = 1;
  for (int64_t i = 0; i < k; i++) {
    numerator = (numerator * (n - i)) % p;
  }
  int64_t denominator = 1;
  for (int64_t i = 1; i <= k; i++) {
    denominator = (denominator * i) % p;
  }
  return (numerator * modInverse(denominator, p)) % p;
}
int main() {
  ios_base::sync_with_stdio(0), cin.tie(0), cout.tie(0);
  ;
  std::cout << std::fixed << std::setprecision(15);
  ;
  int64_t a, b, n, k, i, j, x, y, yy, yyy, ans = 0, ans2 = 0;
  string s;
  cin >> n;
  int64_t arr[n];
  for (i = 0; i < n; i++) cin >> arr[i];
  for (i = 0; i < 32; i++) {
    k = 0;
    for (j = 0; j < n; j++)
      if ((arr[j] & (1 << i))) k++;
    j = ((1 << i) * (k * (n - k))) % 1000000007;
    ans2 += j % 1000000007;
    ans += (1 << i) * (k * (n - k)) % 1000000007;
    ans2 %= 1000000007;
  }
  cout << ans % 1000000007 << "\n";
  cout << "\n";
  return 0;
}
